/*
 * @Author       : 邱狮杰
 * @Date         : 2021-09-01 17:23:59
 * @LastEditTime : 2021-09-01 17:38:10
 * @FilePath     : /newhope/src/utils/mikeChange.ts
 * @Description  :
 */

type mikeChangeTypes = { img: string, style: string, clicked: boolean }[]
export function mikeChange(params: mikeChangeTypes, idx: number): mikeChangeTypes {
	return params.map((item, index) => {
		if (index === idx) {
			item.clicked = true
			item.style = item.style.concat('transform: scale(0);')
			return item
		}
		return item
	}) || []
}
/**
 * @description 牛奶是否被清空
 * @param params 
 * @returns 
 */
export function mikeClear(params: mikeChangeTypes): boolean {
	return params.every(item => item.clicked)
}
/**
 * @description 清空牛奶数量
 * @param params 
 */
export function clearMikeNum(params: mikeChangeTypes): number {
	return params.filter(item => item.clicked).length || 0
}
